Skip to content

DEV: Publish the docs with sourcey, with the MCP server's tools beside the API - #269

Open
auscaster wants to merge 1 commit into
discourse:mainfrom
auscaster:docs/sourcey
Open

auscaster wants to merge 1 commit into
discourse:mainfrom
auscaster:docs/sourcey

Conversation

@auscaster

Copy link
Copy Markdown

I wrote to you about this on 9 November. Here it is as a pull request, ready to merge.

This builds docs.discourse.org with sourcey from the same openapi.json, and publishes it to GitHub Pages from a workflow. The result is a static reference with a page per endpoint. It reads without JavaScript, so search engines index each endpoint and a shared link opens on just that one. It is searchable across the API and the MCP tools together, and every page is also published as Markdown with an llms.txt, so the assistants people point at Discourse can read the API itself.

On the same machine, a reader following a link to one endpoint downloads 49 KB instead of 294 KB, holds 0.8 MB of memory instead of 33 MB, and sees it in 0.23 s instead of 1.8 s.

What's kept:

  • Every deep link into today's page (#tag/Posts/operation/createTopicPostPM and the rest) lands on the endpoint it names. discourse.anchors.json holds those links. If an endpoint leaves the spec later, its old link is reported and dropped (anchorUnmatched: "warn") rather than failing the build.
  • Every file the site serves today keeps its address: openapi.json, openapi.yml, the Bruno and Postman collections, definitions/ and responses/, logo.svg (which the spec's x-logo points to), favicon.png, local.html and index-versioned.html. The workflow copies the repository's files beside the build, and only index.html is replaced.
  • The daily Update Docs workflow, the PR validation and the custom domain are unchanged. Each merged Update Docs PR is a push to main, so the published site follows it the same day.
  • node server.js and local.html for checking spec changes while you write them, as the README describes.
  • The logo, the favicon and Discourse's blue.

What's new:

  • The API's sixteen sections sit under three headings, Content, Community, and Site and administration, set by discourse.overlay.yaml. The spec itself is untouched.
  • An MCP Reference for discourse/discourse-mcp. It covers the 143 tools, the 9 resources, the 2 resource templates and the prompt, under the toolsets the server declares: on by default, or opt-in. Each resource sits with the tools it serves. It's a snapshot (discourse.mcp.json), and npm run mcp:snapshot refreshes it after a release of @discourse/mcp. Anything new that no toolset names yet is listed after the toolsets, and the build says which.
  • logo-dark.svg, the same logo with the wordmark in white, for the dark theme.

One step after merging: set Settings, Pages, Source to GitHub Actions, so the Publish Docs workflow serves the site. The custom domain stays as it is.

To see it locally: npm install && npm run docs. sourcey is a dev dependency, so the lockfile adds its packages and moves 13 shared Babel packages up a minor version. Nothing is removed.

If you need a CLA signed for this, point me to it and I'll sign it.

Kam / maintainer, sourcey

…e the API

docs.discourse.org becomes a static reference built from openapi.json: a page
per endpoint, the sixteen sections under three headings, and every deep link
into the previous page landing on its endpoint. Beside it, the Discourse MCP
server's tools, resources and prompt, in the toolsets the server declares.

The Publish Docs workflow builds it on each push to main and publishes it to
GitHub Pages, with every file the site serves today kept at its address.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant